import request from '@/axios'
import type { UserType } from './types'

interface RoleParams {
  roleName: string
}

export const loginApi = (data: UserType): Promise<IResponse<UserType>> => {
  return request.post({ url: '/admin/account/login', data })
}

export const loginOutApi = (data: Partial<UserType>): Promise<IResponse> => {
  return request.post({ url: '/admin/logout', data })
}

export const getAdminRoleApi = (
  params: Partial<RoleParams>
): Promise<IResponse<AppCustomRouteRecordRaw[]>> => {
  return request.get({ url: '/admin/menu/role/list', params })
}

export const getTestRoleApi = (params: Partial<RoleParams>): Promise<IResponse<string[]>> => {
  return request.get({ url: '/mock/role/list2', params })
}
